#include "encoder.h"
#include "main.h"
#include "gpio.h"
#include "tim.h"

void Encoder_Init()
{
  HAL_TIM_Encoder_Start(&htim3, TIM_CHANNEL_1|TIM_CHANNEL_2);
  HAL_TIM_Encoder_Start(&htim5, TIM_CHANNEL_1|TIM_CHANNEL_2);
  
}


short Encoder1_GetCounter()
{
  return __HAL_TIM_GetCounter(&htim5);
}

short Encoder2_GetCounter()
{
  return __HAL_TIM_GetCounter(&htim3);
}

void Encoder1_ResetCounter()
{
  __HAL_TIM_SetCounter(&htim5, 0);
}

void Encoder2_ResetCounter()
{
  __HAL_TIM_SetCounter(&htim3, 0);
}
